package com.tensquare.test.base.Controller;

import entity.Result;
import entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class BaseExceptionHandle {
    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    Result error(Exception e){
        e.printStackTrace();

        return new Result(false, StatusCode.ERROR,e.getMessage());
    }
}
